Common applications for Apache rewrite rules (rewrite)One: PurposeThis article is intended to provide an approach to how to use Apache rewrite rules to resolve some common URL rewriting methods, through commonExamples give users some basic methods
1. Remove the WWW tag from the domain name The code is as follows :Rewritecond%{http_host}!^jb51\.net$ [NC]Rewriterule.? Http://jb51.net%{request_uri} [R=301,l]2. Remove the www tag, but save the subdomainThe code is as follows
1. Remove the WWW tag from the domain name
Copy Code code as follows:
Rewritecond%{http_host}!^jb51\.net$ [NC]
Rewriterule.? Http://jb51.net%{request_uri} [R=301,l]
2. Remove the WWW tag, but save the child domain name
Run multiple domain-based Web sites on an IP address.Your server has an IP address, and there are many mappings (cnames) to this machine in DNS. You and you want to run the www.example1.com and www.example2.org two sites on this machine.
Apache is one of the most popular HTTP server software, known for its fast, reliable (stable), and with a simple API extension, the Perl/python interpreter can be compiled into the server, completely free, and all the source code is open. If you
Multiple Domain Names are bound to apache on the CentOS server.
Apache is one of the most popular HTTP server software. It is famous for its fast, reliable (and stable) nature and can be expanded through simple APIs, the Perl/Python interpreter can
1. Add www tags to subdomainsRewritecond%{http_host} ^ ([A-Z.] +)? example\.com$ [NC] Rewritecond%{http_host}!^www\. [NC] Rewriterule.? Http://www.%1example.com%{request_uri} [R=301,l]
This rule crawls the%1 variable of level two domain name, if not
System environment: Windows Apache 2.2
Load Rewrite module:
Found in httpd.conf in the Conf directory
The code is as follows
Copy Code
LoadModule Rewrite_module modules/mod_rewrite.so
This sentence, remove
Implement Virtual Domain Name
Complete virtual domain name implementation requires three conditions:1. DNS server wildcard domain name resolution settings; 2. Web
Enable mod_rewriteEnable mod_rewrite moduleTo use the URL rewriting function, you must install the mod_rewrite module. Use the phpinfo () function to find the Apache Modules section. You can see the current apache loading module.If mod_rewrite is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.